from flask import Flask
from flask_cors import CORS
from app.config import Config

def create_app(config_class=Config):
    app = Flask(__name__)
    app.config.from_object(config_class)
    
    # 启用CORS
    CORS(app)
    
    # 注册蓝图
    from routes.weather import weather_bp
    from routes.traffic import traffic_bp
    from routes.travel import travel_bp
    from routes.trafficjam import trafficjam_bp

    app.register_blueprint(weather_bp)
    app.register_blueprint(traffic_bp)
    app.register_blueprint(travel_bp)
    app.register_blueprint(trafficjam_bp)
    
    return app 